package poxer

class FileParserTest extends GroovyTestCase {
    void testParsesWhenStringIntoRequestMatchingObject() {

        def definitions =
        [[
          when: '/foo/bar?a=yes&q=1,2,3',
          then: '<first/>'
        ],[
          when: '/boo/baz',
          then: '<second/>'
        ],[
          otherwise: '<nothing/>'
        ]]

        def parser = new DefParser();
        parser.parse(definitions);

        assertEquals('<first/>', parser.find('/foo/bar?a=yes&q=1,2,3'))

        assertEquals('<second/>', parser.find('/boo/baz'))

        assertEquals(definitions[2].otherwise, parser.find('/nothing'))
    }
}

